package com.linkoog.devtools.middleware.toolwindow.dashboard;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.Disposer;
import com.linkoog.devtools.middleware.toolwindow.dashboard.left.DashboardLeftPanel;
import com.linkoog.devtools.middleware.toolwindow.dashboard.right.DashboardRightPanel;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;

public class MiddlewareDashboardUI extends JPanel  implements Disposable {
    private final Project project;
    private final DashboardLeftPanel dashboardLeftPanel;
    private final DashboardRightPanel dashboardRightPanel;

    public MiddlewareDashboardUI(@NotNull Project project) {
        super(new BorderLayout());
        this.project = project;


        Splitter splitter = new Splitter();
        splitter.setDividerPositionStrategy(Splitter.DividerPositionStrategy.DISTRIBUTE);
        splitter.setProportion(0.25F);
        splitter.setShowDividerControls(true);
        //splitter.setHonorComponentsMinimumSize(true);

        dashboardLeftPanel = new DashboardLeftPanel(project);
        splitter.setFirstComponent(dashboardLeftPanel);
        Disposer.register( this, dashboardLeftPanel);

        dashboardRightPanel = new DashboardRightPanel(project);
        splitter.setSecondComponent(dashboardRightPanel);
        Disposer.register( this, dashboardRightPanel);


        add(splitter, BorderLayout.CENTER);
    }

    @Override
    public void dispose() {
    }


}
